package util;

import java.time.LocalTime;
import java.util.HashMap;
import java.util.Map;

/**
 * 时间段管理工具类
 */
public class TimeSlotManager {
    private static final Map<String, TimeSlot> TIME_SLOTS = new HashMap<>();

    static {
        TIME_SLOTS.put("上午", new TimeSlot("上午", LocalTime.of(8, 0), LocalTime.of(12, 0)));
        TIME_SLOTS.put("下午", new TimeSlot("下午", LocalTime.of(13, 0), LocalTime.of(17, 0)));
        TIME_SLOTS.put("晚上", new TimeSlot("晚上", LocalTime.of(18, 0), LocalTime.of(22, 0)));
    }

    public static TimeSlot getTimeSlot(String name) {
        return TIME_SLOTS.get(name);
    }

    public static Map<String, TimeSlot> getAllTimeSlots() {
        return TIME_SLOTS;
    }

    public static class TimeSlot {
        private String name;
        private LocalTime startTime;
        private LocalTime endTime;

        public TimeSlot(String name, LocalTime startTime, LocalTime endTime) {
            this.name = name;
            this.startTime = startTime;
            this.endTime = endTime;
        }

        // Getters
        public String getName() {
            return name;
        }

        public LocalTime getStartTime() {
            return startTime;
        }

        public LocalTime getEndTime() {
            return endTime;
        }

        @Override
        public String toString() {
            return name + " (" + startTime + "-" + endTime + ")";
        }
    }
}
